/* VIM Master Game - Main Styles */

body {
    font-family: 'Fira Code', monospace;
    overscroll-behavior: none; /* Prevents pull-to-refresh on mobile */
    background-attachment: fixed;
}

.vim-editor {
    white-space: pre;
    line-height: 1.5;
    caret-color: transparent;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
}

.line-number {
    color: #858585;
    text-align: right;
    padding-right: 1rem;
    user-select: none;
}

.cursor {
    background-color: #f2c55c;
    color: #1e1e1e;
    animation: blink 1s step-end infinite;
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(242, 197, 92, 0.6);
}

@keyframes blink {
    50% {
        background-color: transparent;
        outline: 1px solid #f2c55c;
        color: inherit;
        box-shadow: 0 0 4px rgba(242, 197, 92, 0.3);
    }
}

.status-bar {
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.modal-bg {
    background-color: rgba(0,0,0,0.7);
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.modal-content {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.level-complete-flash {
    animation: flash 0.5s ease-out;
}

@keyframes flash {
    0% { box-shadow: 0 0 0 0 rgba(242, 197, 92, 0.7); }
    100% { box-shadow: 0 0 0 20px rgba(242, 197, 92, 0); }
}

.ascii-logo {
    line-height: 1.2;
    filter: drop-shadow(0 0 8px rgba(250, 204, 21, 0.3));
    animation: logoGlow 3s ease-in-out infinite alternate;
}

@keyframes logoGlow {
    0% { filter: drop-shadow(0 0 8px rgba(250, 204, 21, 0.3)); }
    100% { filter: drop-shadow(0 0 16px rgba(250, 204, 21, 0.6)); }
}

/* Celebration styles */
.celebration-bg { 
    background: radial-gradient( circle at center, rgba(34,197,94,0.2), rgba(30,58,138,0.85) ); 
}

.celebration-overlay { 
    position: absolute; 
    inset: 0; 
    background: rgba(0,0,0,0.72); 
    backdrop-filter: blur(3px); 
}

.celebration-text {
    animation: pop 1s ease-out forwards, glow 2.5s ease-in-out infinite alternate;
}

@keyframes pop { 
    0% { transform: scale(0.8); opacity: 0 } 
    100% { transform: scale(1); opacity: 1 } 
}

@keyframes glow { 
    0% { text-shadow: 0 0 10px rgba(250,204,21,.6) } 
    100% { text-shadow: 0 0 30px rgba(250,204,21,1) } 
}

.confetti { 
    position: fixed; 
    top: -10px; 
    font-size: 18px; 
    animation: fall linear forwards; 
    pointer-events: none; 
}

@keyframes fall { 
    to { transform: translateY(110vh) rotate(360deg); opacity: .9 } 
}

/* Badges */
.badge {
    transition: all 0.3s ease;
    transform: scale(1);
}

.badge:hover {
    transform: scale(1.1);
    filter: brightness(1.2);
}

/* Badges */
.badge-card { box-shadow: 0 6px 18px rgba(30, 64, 175, 0.25); }
.badge-card:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(30, 64, 175, 0.4); }

/* Progress Management System */
.progress-message {
    transition: all 0.3s ease;
}

.progress-message.success {
    color: #4ade80;
    animation: fadeInUp 0.3s ease;
}

.progress-message.error {
    color: #f87171;
    animation: fadeInUp 0.3s ease;
}

.progress-message.info {
    color: #60a5fa;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Progress Code Input Styling */
#export-code, #import-code {
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    transition: all 0.3s ease;
}

#export-code:focus, #import-code:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Progress Management Container Animations */
#export-code-container, #import-code-container {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#export-code-container.hidden, #import-code-container.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

/* Compact Progress Management Styling */
#progress-summary {
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Progress Toggle Styling */
#progress-toggle {
    transition: all 0.3s ease;
    cursor: pointer;
}

#progress-toggle:hover {
    background: linear-gradient(to right, rgba(75, 85, 99, 0.8), rgba(55, 65, 81, 0.8));
    border-color: rgba(156, 163, 175, 0.5);
    transform: translateY(-1px);
}

#progress-details {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Compact Badge Styling */
#badge-section .badge {
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

#badge-section .badge:hover {
    transform: scale(1.15);
    filter: brightness(1.3);
}

/* Achievements Section Positioning */
#badge-section {
    transition: all 0.3s ease;
}

#badge-section:not(.hidden) {
    animation: fadeInUp 0.4s ease-out;
}

/* Compact Challenge Styling */
#challenge-container {
    transition: all 0.3s ease;
}

#challenge-container.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

/* Responsive Design for Compact Layout */
@media (max-width: 768px) {
    #progress-summary {
        font-size: 0.875rem;
    }
    
    #badge-section .badge {
        font-size: 1rem;
    }
    
    #challenge-container .text-2xl {
        font-size: 1.25rem;
    }
    
    #challenge-container .text-lg {
        font-size: 1rem;
    }
}

/* Progress Summary Styling */
#progress-summary {
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#last-saved-time {
    font-style: italic;
    opacity: 0.8;
}

/* Button hover effects */
button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button:hover {
    transform: translateY(-2px);
}

/* Level selection buttons */
.level-btn {
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.level-btn:hover {
    border-color: #f2c55c;
    box-shadow: 0 0 12px rgba(242, 197, 92, 0.4);
}

.level-btn.current {
    border-color: #f2c55c;
    box-shadow: 0 0 16px rgba(242, 197, 92, 0.6);
}

.level-btn.completed {
    border-color: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

/* Challenge mode improvements */
#challenge-container {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cheat mode improvements */
#cheat-panel {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#cheat-panel.translate-x-full {
    transform: translateX(100%);
}

#cheat-panel:not(.translate-x-full) {
    transform: translateX(0);
}

/* Input focus effects */
input:focus {
    box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.1);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(55, 65, 81, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.8);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 1);
}

/* Responsive improvements */
@media (max-width: 768px) {
    .ascii-logo {
        font-size: 0.5rem;
    }
    
    #challenge-container {
        margin: 1rem 0;
    }
    
    .modal-content {
        margin: 1rem;
        max-width: calc(100vw - 2rem);
    }
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced cursor animations */
.cursor.insert {
    background-color: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.cursor.visual {
    background-color: #8b5cf6;
    box-shadow: 0 0 8px rgba(139, 92, 244, 0.6);
}

.cursor.search {
    background-color: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}
